Skip to content

Bugfix: protocol: Enforce username length limit seeking into message#181

Open
luke-jr wants to merge 4 commits intoOCEAN-xyz:masterfrom
luke-jr:fix_username_overflow
Open

Bugfix: protocol: Enforce username length limit seeking into message#181
luke-jr wants to merge 4 commits intoOCEAN-xyz:masterfrom
luke-jr:fix_username_overflow

Conversation

@luke-jr
Copy link
Copy Markdown
Contributor

@luke-jr luke-jr commented Apr 5, 2026

Without this, only 384 bytes get written for the username, but extra space is included in the message before the rest of the data

Without this, only 384 bytes get written for the username, but extra space is included in the message before the rest of the data
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a protocol message framing issue in datum_protocol_pow() by ensuring the username field advances the message cursor by the actual written byte count (bounded to the buffer limit), preventing unintended gaps in the serialized message.

Changes:

  • Switch from i += snprintf(...) to capturing the snprintf result in j for the username field.
  • Clamp the username byte-count used to advance i to the protocol/buffer maximum.
  • Advance i by j + 1 to account for the terminating null byte.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/datum_protocol.c
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/datum_protocol.c
Comment thread src/datum_protocol.c Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/datum_protocol.h
Comment thread src/datum_protocol.c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants